<template>
	<view class="">
		<view class="header1">
			<view class="ipt-box">
				<input @input="searChange" v-model="searchIpt" type="text" value="" placeholder="请输入档案号" placeholder-class="plac-class" />
				<image src="/static/search1.png" mode="" @click="searNum"></image>
			</view>
			<view class="header1-right" @click="clousText">
				<span>取消</span> 
			</view>
		</view>
		<view class="all">
			<view class="list-item" v-for="i,index in list" :key="index" @tap="jump(i.status,i.id)">
				<view class="list-item-content">
					<view class="items">
						<image class="portrait" src="../../static/aqy.png" mode=""></image>
						<text class="colorhui">{{i.build_unit_username}}</text>
					</view>
					<view class="items">
						<text>跟踪编号：</text>
						<text class="colorhui">{{i.third_party_no}}</text>
					</view>
					<view class="items">
						<text>施工类型：</text>
						<text class="colorhui">{{i.construction_type_text}}</text>
					</view>
					<view class="items">
						<text>建设单位：</text>
						<text class="colorhui">{{i.build_unit}}</text>
					</view>
					<view class="items" @tap.stop="callNum(i.build_unit_mobile)">
						<text>建设联系人电话：</text>
						<text class="colorhui">{{i.build_unit_mobile}}</text>
					</view>
					<view class="items">
						<text>施工单位：</text>
						<text class="colorhui">{{i.construction_unit}}</text>
					</view>
					<view class="items">
						<text>施工联系人：</text>
						<text class="colorhui">{{i.construction_unit_username}}</text>
					</view>
					<view class="items" @tap.stop="callNum(i.construction_unit_mobile)">
						<text>施工联系电话：</text>
						<text class="colorhui">{{i.construction_unit_mobile}}</text>
					</view>
					<view class="items" v-if="i.track!=0&&i.status!=3">
						<text>跟踪状态：</text>
						<text class="colorhui">
							<template v-if="i.track==1">
								跟踪中
							</template>
							<template v-if="i.track==2">
								跟踪已完成
							</template>
						</text>
					</view>
					<view class="items">
						<text style="white-space: nowrap;">地址：</text>
						<text class="colorhui">{{i.address}}</text>
					</view>
				</view>
				<view class="list-item-status" v-if="i.status==3">
					<image class="status-img" src="../../static/pagesB/butongguo.png" mode=""></image>
				</view>
				<view class="list-item-status" v-if="i.status==2">
					<image class="status-img" src="../../static/pagesB/tongguo.png" mode=""></image>
				</view>
				<view class="list-item-status" v-if="i.status==1">
					<image class="status-img" src="../../static/pagesB/tijiao.png" mode=""></image>
				</view>
			</view>
		</view>
		<das-add @tap="skip()"></das-add>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				list:[],
				searchIpt:'',
				page:1,
			}
		},
		onLoad(){
			
		},
		onShow(){
			this.list = []
			this.initData()
		},
		onReachBottom() {
			this.page ++ 
			this.initData()
		},
		methods:{
			jump(status,id){
				if(status == 3){
					this.$navTo('./track?id='+id)
					return false;
				}
				this.$navTo('/pagesB/track/trackDetails?id='+id)
			},
			callNum(num){
				num&&uni.makePhoneCall({
					phoneNumber:num
				})
			},
			initData(){
				let _this = this
				uni.request({
					url: this.$url + 'staff.third_party/getList',
					method: 'POST',
					header: {
						token: uni.getStorageSync('token'),
					},
					data:{
						page:_this.page,
						searchname:_this.searchIpt
					},
					success: res => {
						_this.searchIpt = ''
						_this.list = _this.list.concat(res.data.data)
					},
					fail: () => {},
					complete: () => {}
				});
			},
			skip(){
				this.$navTo('./track')
			},
			searNum() {
				let that = this
				if(that.searchIpt == '') {
					uni.showToast({
						title: '请输入要搜索的编号',
						icon: 'none'
					})
					return
				}
				this.list = []
				this.page = 1
				this.initData()
			},
			clousText() {
				this.searchIpt = ''
				uni.navigateBack({
					delta:1
				})
			},
		}
	}
</script>

<style lang="less" scoped>
	.header1{
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		height: 80rpx;
		width: 100%;
		background-color: #003690;
		padding: 0 40rpx;
		.ipt-box{
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-sizing: border-box;
			padding: 0 20rpx;
			width: 480rpx;
			height: 52rpx;
			background-color: #fff;
			border-radius: 24rpx;
			image{
				width: 32rpx;
				height: 32rpx;
			}
		}
		.header1-right{
			display: flex;
			align-items: center;
			font-size: 28rpx;
			color: #E2ECFB;
			image{
				width: 36rpx;
				height: 36rpx;
			}
		}
	}
	.all {
		padding: 22rpx 32rpx 0;
		min-height: 100vh;
		background: #F1F1F1;
		.list-item {
			background: #FFFFFF;
			box-shadow: 0rpx 4rpx 6rpx rgba(0, 30, 57, 0.1);
			border-radius: 16rpx;
			display: flex;
			padding: 0rpx 20rpx;
			margin-bottom: 22rpx;
			align-items: center;
			justify-content: space-between;
		
			.list-item-content {
				width: 452rpx;
		
				.items {
					display: flex;
					align-items: center;
					padding: 5rpx 0;
		
					.portrait {
						width: 36rpx;
						height: 36rpx;
					}
		
					.colorhui {
						color: #999999;
					}
				}
			}
		
			.list-item-status {
				width: 171rpx;
				height: 174rpx;
		
				.status-img {
					display: block;
					width: 100%;
					height: 100%;
				}
			}
		}
		
	}
</style>
